<template>
	<view class="app">
		<!-- 顶部搜索和顶部标题 -->
		<view class="head">
			<view style="width: 100%; height: 20%; margin-top: -20px; background-color: white;"></view>
			<view class="head-a">
				<view class="head-a-a">
					<uni-search-bar class="uni-mt-10" radius="100" placeholder="输入课程关键字" clearButton="none"
						cancelButton="none" box-shadow="0 0 10px rgba(0, 0, 0, 0.1)"></uni-search-bar>
				</view>
			</view>

			<!-- 筛选菜单 -->
			<view class="sxcd">
				<u-tabs :list="list1">
					<view slot="right" style="padding-left: 4px;" @tap="$u.toast('插槽被点击')">
						<u-icon name="list" size="21" bold></u-icon>
					</view>
				</u-tabs>
			</view>
		</view>
		<!-- 课程 -->
		<view class="kc">
			<view class="kc-a" v-for="(item,index) in list2" :key="index">
				<image :src="item.img" style="width: 100%; height: 70%;"></image>
				<view class="kc-a-a">
					<view class="kc-a-a-a">
						<text style="font-size: 15px; font-weight: bold; margin-left: 10px;">{{item.kename}}</text>
					</view>
					<view class="kc-a-a-b">
						<view class="kc-a-a-b-a">
							<view
								style="width: 60%; height: 80%; display: flex; margin-left: 10px; margin-top: 4px;border-radius: 50%;">
								<image :src="item.tx" style="width: 100%; height: 100%;"></image>
							</view>

						</view>
						<view class="kc-a-a-b-b">
							<text>{{item.name}}</text>
							<text><text style="color: #FBBD61;">{{item.people}}</text>人已学习</text>
						</view>
					</view>
				</view>
			</view>
		</view>

		<!-- 加载中 -->
		<view class="jiazz">
			<view class="jiazz-a u-border-bottom" v-for="(item, index) in aaa" :key="index">
				{{'第' + item + '条数据'}}
			</view>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [{
					name: '关注',
				}, {
					name: '推荐',
				}, {
					name: '电影'
				}, {
					name: '科技'
				}, {
					name: '音乐'
				}, {
					name: '美食'
				}, {
					name: '文化'
				}, {
					name: '财经'
				}, {
					name: '手工'
				}],
				list2: [{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方得逼',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					},
					{
						img: '/static/u93.png',
						kename: 'IOS高级课程',
						name: '方域名',
						people: 250,
						tx: '/static/u2542.png'
					}
				],
				status: 'loadmore',
				aaa: 0,
				page: 0
			}
		},
		onReachBottom() {
			if (this.page >= 3) return;
			this.status = 'loading';
			this.page = ++this.page;
			setTimeout(() => {
				this.aaa += 0;
				if (this.page >= 3) this.status = 'nomore';
				else this.status = 'loading';
			}, 2000)
		}
	}
</script>

<style lang="scss">
	.app {
		padding: 0;
		margin: 0;

		// 顶部搜索和顶部标题
		.head {
			width: 100%;
			height: 150px;
			margin: 0 auto;
			position: fixed;
			z-index: 3;
			background-color: white;
			// background: linear-gradient(135deg, #f6d365, #fda085);

			.head-a {
				width: 100%;
				height: 50%;
				display: flex;
				align-items: center;

				.head-a-a {
					width: 55%;
					height: 55px;
					margin: 0 auto;
				}
			}

			// 筛选菜单
			.sxcd {
				width: 93%;
				height: 20%;
				margin: 0 auto;
			}
		}

		// 课程
		.kc {
			width: 80%;
			margin: 0 auto;
			position: relative;
			top: 150px;
			z-index: 2;

			.kc-a {
				width: 100%;
				height: 240px;
				background: -webkit-linear-gradient(270deg, rgba(219, 218, 252, 1) 0%, rgba(219, 218, 252, 1) 0%, rgba(221, 220, 252, 1) 22%, rgba(223, 220, 251, 1) 54%, rgba(235, 233, 254, 1) 75%, rgba(244, 242, 255, 1) 100%, rgba(244, 242, 255, 1) 100%);
				margin-top: 20px;

				.kc-a-a {
					width: 100%;
					height: 30%;

					.kc-a-a-a {
						width: 100%;
						height: 30%;
					}

					.kc-a-a-b {
						width: 100%;
						height: 43px;
						display: flex;

						.kc-a-a-b-a {
							width: 17%;
							height: 100%;
						}

						.kc-a-a-b-b {
							width: 80%;
							height: 100%;
							display: flex;
							color: #999999;
							font-size: 13px;
							justify-content: space-between;
							align-items: center;
						}
					}
				}
			}
		}

		// 加载中
		.jiazz {
			width: 93%;
			margin: 0 auto;
			height: 100px;
			margin-top: 180px;

			.jiazz-a {
				padding: 24rpx 0;
				color: $u-content-color;
				font-size: 28rpx;
			}
		}
	}
</style>